/* $Id: list_games.h jjs $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/
#ifndef LIST_GAMES_H
#define LIST_GAMES_H

#include <gtkmm.h>
#include <libglademm.h>

/// Windows for a list of games

class list_games : public Gtk::Window {
  public:
	list_games(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> refGlade); ///< window
	virtual ~list_games();  ///< remove the window data
	void load();            ///< load the data from the memory structure

  protected:
	Glib::RefPtr<Gnome::Glade::Xml> m_refGlade;
	virtual void clicked_cancel();
	virtual void clicked_chat();
	virtual void clicked_new_game();
	Gtk::Button* cancel_game;
	Gtk::Button* new_game;
	Gtk::Button* join_game;
	Gtk::Button* general_chat;
	Gtk::TreeView* games_list;
	Glib::RefPtr<Gtk::ListStore> games_store;
	virtual void clicked_game(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);


    /// Definition of the columns on the screen
	struct ModelColumns : public Gtk::TreeModelColumnRecord {
    	Gtk::TreeModelColumn<Glib::ustring> name;
    	Gtk::TreeModelColumn<Glib::ustring> owner;
    	Gtk::TreeModelColumn<Glib::ustring> join;
    	Gtk::TreeModelColumn<Glib::ustring> goal;
    	Gtk::TreeModelColumn<Glib::ustring> game_map;
    	Gtk::TreeModelColumn<Glib::ustring> description;
        Gtk::TreeModelColumn<int> game_nr;
    	ModelColumns()
		{
			add(name); add(owner); add(join); add(goal); add(game_map); add(description);
			add(game_nr);
		}
	};
	const ModelColumns cols;
};

#endif //LIST_GAMES_H
